//
// Abstract.hh for  in /home/jousse_f//workspace/C++/abstractVM
// 
// Made by florian jousseau
// Login   <jousse_f@epitech.net>
// 
// Started on  Mon Feb  6 11:01:46 2012 florian jousseau
// Last update Thu Feb 16 18:11:50 2012 florian jousseau
//

#ifndef ABSTRACT_HH_
# define ABSTRACT_HH_

#include <list>
#include "IOperand.hh"
#include "Parser.hh"

class		VM
{
  Parser	*P;
public:
  std::list<IOperand *>        stack;

public:
  VM();
  ~VM();
  Parser			*getParser() const;
  std::list<IOperand *>		getStack() const;
  void				setParser(Parser *p);
  VM				&operator=(const VM &other);
  typedef struct		s_fct
  {
    IOperand			*(VM::*ptr)(const std::string & value);
    eOperandType		type;
  }				t_fct;

  IOperand *createOperand(eOperandType type, const std::string & value);

private:
  IOperand *createInt8(const std::string & value);
  IOperand *createInt16(const std::string & value);
  IOperand *createInt32(const std::string & value);
  IOperand *createDouble(const std::string & value);
  IOperand *createFloat(const std::string & value);
  static const t_fct    tab_fct[];
};

#endif /* !ABSTRACT_H_ */
